<script>
import Common from "@/mixins/order/common.js";
import OrderService from "@/api/order/OrderService.js";
import PPMForm from "@/crm3.0part7-ppm/core/ppmForm.vue";
export default {
  name: "ipran10460044",
  mixins: [PPMForm, Common],
  data() {
    return {
      // proName: 'MSTP'
      //dialog-input对应的配置
      cirVal: "0",
      feeVal: "", //费用变量值
    };
  },
  mounted() {
    if (this.formData["1688-100010640"]) {
      this.init(); //初始化方法
      this.qryAccList();
      this.ctrlfold(false, "10460339"); //cjj隐藏甲乙端边框
      this.IDC(this.formData["10460341-100012631"].value); //是否IDC机房专线
      this.yunProvider(this.formData["10460341-142002430"].value); //业务场景
      this.onceIPRANFee(); //一次性费是否一口价
      this.monthFEE(this.formData["10460378-100012610"].value); //一次性费是否一口价
      this.businessType(this.formData["10460341-100001004"].value); //业务类型
      this.cloudProvider(); //云服务提供商
      this.devIsEmptyIPRAN();
    }
  },
  computed: {},
  methods: {
    //初始化方法   houbin add
    init() {
      //租用性质 默认长期隐藏
      this.formData["TD_V_HIRE_KIND"].value = "80050002002";
      this.formData["TD_V_HIRE_KIND"].isshow = false;
      // 优先级 默认普通隐藏
      this.formData["ORDER_ITEM-PRIORITY"].value = "80050032001";
      this.formData["ORDER_ITEM-PRIORITY"].isshow = false;
      //管理电路接入的城市 默认隐藏
      //集团受理时
      let orgId = this.user.orgId;
      if (orgId == "1944640") {
        this.formData["10460341-100012631"].isshow = false; //是否idc机房专线字段 隐藏
        //是否idc机房专线字段 非必填
        this.SetRequired({
          attrName: "",
          formkey: "10460341-100012631",
          reqName: "empty",
          reqStatus: false,
        });

        //是否提供进度报告
        this.formData["10460342-141000001"].value = "1";
        this.formData["10460342-141000001"].text = "是";
      } else {
        //是否提供进度报告
        this.formData["10460342-141000001"].value = "";
        this.formData["10460342-141000001"].text = "";
      }
      //国际公司展示
      if (
        orgId == "1944890" ||
        orgId == "1944891" ||
        orgId == "1944889" ||
        orgId == "1950850" ||
        orgId == "1978013"
      ) {
        this.formData["10460427-100013366"].text = "集团公司"; //甲端一次性委托收款单位
        this.formData["10460427-100013366"].value = "DXJT0000";
        this.formData["10460428-100013366"].text = "集团公司"; //乙端一次性委托收款单位
        this.formData["10460428-100013366"].value = "DXJT0000";
        this.formData["10460383-100010008"].text = "集团公司"; //甲端本地费 月租委托收款单位
        this.formData["10460383-100010008"].value = "DXJT0000";
        this.formData["10460384-100010008"].text = "集团公司"; //乙端本地费 月租委托收款单位
        this.formData["10460384-100010008"].value = "DXJT0000";
        this.formData["10460385-100012144"].text = "集团公司"; //甲端长途委托收费单位
        this.formData["10460385-100012144"].value = "DXJT0000";
        this.formData["10460385-100012143"].text = "集团公司"; //乙端长途委托收费单位
        this.formData["10460385-100012143"].value = "DXJT0000";
        this.formData["10460378-100010008"].text = "集团公司"; //多云接入端口委托收款单位
        this.formData["10460378-100010008"].value = "DXJT0000";
      }
      //电路标签为普通电路
      this.formData["10460378-142002190"].value = this.elecLabel;
      if (this.elecLabel == "13241001") {
        this.formData["10460378-142002190"].isshow = false; //电路标签
        this.formData["10460378-142002191"].isshow = false; //电路标签文号
      } else if (
        this.elecLabel == "13241002" ||
        this.elecLabel == "13241003" ||
        this.elecLabel == "13241004"
      ) {
        this.nonGeneralCircuit();
        this.Isshow("1", "10460379"); //甲乙端一次性费隐藏
        this.Isshow("1", "10460382"); //甲乙端本地费用
        this.Isshow("1", "10460385"); //国内长途
        // this.Isshow('1', '10460175');//国际长途
        // this.Isshow('1', '10460176');//国际对端
      }
      //运营商 必填
      this.SetRequired({
        attrName: "甲端运营商",
        formkey: "2079-100010765",
        reqName: "empty",
        reqStatus: true,
        attrType: "button",
      });
      this.SetRequired({
        attrName: "乙端运营商",
        formkey: "2080-100010765",
        reqName: "empty",
        reqStatus: true,
        attrType: "button",
      });
      this.formData["10460378-142001024"].isshow = false; //预收月数
    },

    // //电路维护等级
    cirMain(val) {
      // //限制电路维护等级AAA不能在业务场景为云网融合时选择
      // if (
      //   val == "80050036001" &&
      //   this.formData["10460341-142002430"].value == "227900002"
      // ) {
      //   this.cirVal = "1";
      //   this.cirMainS();
      // }
    },

    // cirMainS() {
    //   if (this.cirVal == "1") {
    //     this.$alert(
    //       "业务场景为云网融合型时，电路维护等级不能选择AAA级!",
    //       "提示",
    //       {
    //         type: "warning",
    //         confirmButtonText: "关闭",
    //       }
    //     );
    //     var abj = document
    //       .getElementById("10460341-100011554") //电路维护等级
    //       .getElementsByClassName("el-radio-button");

    //     for (var i = 0; i < abj.length; i++) {
    //       if (abj[i].firstChild.value == "80050036001") {
    //         abj[i].parentNode.removeChild(abj[i]);
    //       }
    //     }
    //     this.formData["10460341-100011554"].value = "";
    //   } else {
    //     var abj = document
    //       .getElementById("10460341-100011554")
    //       .getElementsByClassName("el-radio-button");
    //
    //
    //     if (!(abj[0].firstChild.value == "80050036001")) {
    //       //加AAA级
    //       var d1 = abj[0];
    //       d1.insertAdjacentHTML(
    //         "beforeBegin",
    //         '<label role="radio" tabindex="-1" class="el-radio-button"><input type="radio" tabindex="-1" class="el-radio-button__orig-radio" value="80050036001"><span class="el-radio-button__inner">AAA级</span></label>'
    //       );
    //     }
    //   }
    //  // alert(this.formData["10460341-100011554"].value);
    // },

    //业务场景
    yunProvider(val) {
      //云网融合型
      if (val == "227900002") {
        // //电路维护等级  AAA
        // if (this.formData["10460341-100011554"].value == "80050036001") {
        //   this.cirVal = "1";
        //   this.cirMainS();
        // }
        //入云信息显示
        //云服务提供商展示且必填
        this.formData["10460342-142002912"].isshow = true; //云服务提供商 展示
        // this.SetRequired("1", "10460342-142002912"); //云服务提供商 必填
        this.SetRequired({
          attrName: "云服务提供商",
          formkey: "10460342-142002912",
          reqName: "empty",
          reqStatus: true,
        });

        this.formData["10460342-142002912"].value = "22113552601";
        this.cloudProvider();
        //非上海省份展示天翼云，不可改
        if (this.user.regionCode != "8310100") {
          this.formData["10460342-142002912"].disabled = true;
        }
        if (
          //阿里云、腾讯云、华为云、微软云、AWS、上海自有云（CLSN）、百度云、UCloud
          this.formData["10460342-142002912"].value != "22113552602" &&
          this.formData["10460342-142002912"].value != "22113552603" &&
          this.formData["10460342-142002912"].value != "22113552604" &&
          this.formData["10460342-142002912"].value != "22113552605" &&
          this.formData["10460342-142002912"].value != "22113552606" &&
          this.formData["10460342-142002912"].value != "22113552607" &&
          this.formData["10460342-142002912"].value != "22113552608" &&
          this.formData["10460342-142002912"].value != "22113552609"
        ) {
          this.formData["10460342-142002269"].isshow = true; //资源池类型 展示
          this.SetRequired({
            attrName: "资源池类型",
            formkey: "10460342-142002269",
            reqName: "empty",
            reqStatus: true,
          });
          this.formData["10460342-142002269"].value = "2019072001";
        }
        this.formData["10460342-142001052"].isshow = true; //云资源池站点 展示
        this.SetRequired({
          attrName: "云资源池站点",
          formkey: "10460342-142001052",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10460342-142001053"].isshow = true; //云账号
        this.SetRequired({
          attrName: "云账号",
          formkey: "10460342-142001053",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10460342-100011674"].isshow = true; //客户侧网段/掩码
        this.SetRequired({
          attrName: "客户侧网段/掩码",
          formkey: "10460342-100011674",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10460342-142002014"].isshow = true; //云侧互联地址/掩码
        this.formData["10460342-142002013"].isshow = true; //客户侧互联地址/掩码
        this.formData["10460342-142002152"].isshow = true; //本端VPC ID网段/掩码
        this.SetRequired({
          attrName: "本端VPC ID网段/掩码",
          formkey: "10460342-142002152",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10460342-142002011"].isshow = true; //本端VPC ID
        this.SetRequired({
          attrName: "本端VPC ID",
          formkey: "10460342-142002011",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10461245-142002911"].isshow = false; //甲端 是否需要U设备
        this.SetRequired({
          attrName: "是否需要U设备",
          formkey: "10461245-142002911",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461246-142002911"].isshow = false; //乙端 是否需要U设备
        this.SetRequired({
          attrName: "是否需要U设备",
          formkey: "10461246-142002911",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        //普通组网
        //入云信息影藏
        this.formData["10460342-142002912"].isshow = false; //云服务提供商 展示
        this.SetRequired({
          attrName: "",
          formkey: "10460342-142002912",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460342-142002912"].value = "";
        this.formData["10460342-142002912"].text = "";
        this.formData["10460342-142002269"].isshow = false; //资源池类型 隐藏
        this.SetRequired({
          attrName: "",
          formkey: "10460342-142002269",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460342-142002269"].value = "";
        this.formData["10460342-142002269"].text = "";
        // this.formData["10460342-142002269"].value = "2019072001"; //资源池类型 默认公有云
        this.resourcePool("2019072001");
        this.formData["10460342-142001052"].isshow = false; //云资源池站点 隐藏
        this.SetRequired({
          attrName: "",
          formkey: "10460342-142001052",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460342-142001052"].value = "";
        this.formData["10460342-142001052"].text = "";
        this.formData["10460342-142001053"].isshow = false; //云账号
        this.SetRequired({
          attrName: "",
          formkey: "10460342-142001053",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460342-142001053"].value = "";
        this.formData["10460342-100011674"].isshow = false; //客户侧网段/掩码
        this.SetRequired({
          attrName: "",
          formkey: "10460342-100011674",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460342-100011674"].value = "";
        this.formData["10460342-142002014"].isshow = false; //云侧互联地址/掩码
        this.formData["10460342-142002014"].value = "";
        this.formData["10460342-142002013"].isshow = false; //客户侧互联地址/掩码
        this.formData["10460342-142002013"].value = "";
        this.formData["10460342-142002152"].isshow = false; //本端VPC ID网段/掩码
        this.SetRequired({
          attrName: "",
          formkey: "10460342-142002152",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460342-142002152"].value = "";
        this.formData["10460342-142002011"].isshow = false; //本端VPC ID
        this.SetRequired({
          attrName: "",
          formkey: "10460342-142002011",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460342-142002011"].value = "";
        this.formData["10460342-142002011"].text = "";
        this.formData["10461245-142002911"].isshow = true; //甲端 是否需要U设备
        this.SetRequired({
          attrName: "是否需要U设备",
          formkey: "10461245-142002911",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10461246-142002911"].isshow = true; //乙端 是否需要U设备
        this.SetRequired({
          attrName: "是否需要U设备",
          formkey: "10461246-142002911",
          reqName: "empty",
          reqStatus: true,
        });
      }
    },

    //云服务提供商 houbin add
    cloudProvider() {
      //业务场景为云资源池、资源池类型为空 时默认公有云
      if (this.formData["10460341-142002430"].value == "227900002") {
        this.formData["10460342-142002269"].isshow = true;
        this.SetRequired({
          attrName: "资源池类型",
          formkey: "10460342-142002269",
          reqName: "empty",
          reqStatus: true,
        });
        if (this.formData["10460342-142002269"].value == "") {
          this.formData["10460342-142002269"].value = "2019072001";
        }
      }
      let val = this.formData["10460342-142002912"].value;
      if (val != "22113552601") {
        //不为天翼云
        this.formData["10460378-142003015"].isshow = true; //多云接入端口月使用费
        this.formData["10460378-100010007"].isshow = true; //多云接入端口收款单位
        this.formData["10460378-100010008"].isshow = true; //多云接入端口委托收款单位
        this.formData["10460378-100011056"].isshow = true; //多云接入端口币种

        if (
          //阿里云、腾讯云、华为云、微软云、AWS、上海自有云（CLSN）、百度云、UCloud
          val == "22113552602" ||
          val == "22113552603" ||
          val == "22113552604" ||
          val == "22113552605" ||
          val == "22113552606" ||
          val == "22113552607" ||
          val == "22113552608" ||
          val == "22113552609"
        ) {
          this.formData["10460342-142002269"].isshow = false; //资源池类型
          this.formData["10460342-142002269"].value = "";
          this.SetRequired("0", "10460342-142002269");
          this.SetRequired({
            attrName: "",
            formkey: "10460342-142002269",
            reqName: "empty",
            reqStatus: false,
          });
        }
      } else {
        this.formData["10460378-142003015"].isshow = false; //多云接入端口月使用费
        this.formData["10460378-142003015"].value = "";
        this.formData["10460378-100010007"].isshow = false; //多云接入端口收款单位
        this.formData["10460378-100010008"].isshow = false; //多云接入端口委托收款单位
        this.formData["10460378-100011056"].isshow = false; //多云接入端口币种
        this.formData["10460378-100011056"].value = "156"; //甲端一次性费币种
        let orgId = this.user.orgId;
        if (
          orgId == "1944890" ||
          orgId == "1944891" ||
          orgId == "1944889" ||
          orgId == "1950850" ||
          orgId == "1978013"
        ) {
          this.formData["10460378-100010008"].text = "集团公司"; ////多云接入端口委托收款单位
          this.formData["10460378-100010008"].value = "DXJT0000";
        }
      }
    },

    //资源池类型  houbin add
    resourcePool(val) {
      if (val == "2019072002") {
        //专属云
        this.formData["10460342-142002189"].isshow = true; //专属云ID 展示
        this.formData["10460342-142002183"].isshow = true; //专属云名称 展示
        this.SetRequired({
          attrName: "专属云ID",
          formkey: "10460342-142002189",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "专属云名称",
          formkey: "10460342-142002183",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.formData["10460342-142002189"].isshow = false; //专属云ID 隐藏
        this.SetRequired({
          attrName: "",
          formkey: "10460342-142002189",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460342-142002189"].text = "";
        this.formData["10460342-142002189"].value = "";
        this.formData["10460342-142002183"].isshow = false; //专属云名称 隐藏
        this.SetRequired({
          attrName: "",
          formkey: "10460342-142002183",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460342-142002183"].value = "";
      }
    },

    collectA(val) {
      //甲端是否汇聚
      //点到多点
      if (
        val == "2" &&
        this.formData["10461246-142002428"].value == "2" &&
        this.formData["10460341-100001004"].value == "88800130002"
      ) {
        this.$message({
          message: "甲端乙端是否汇聚不可以同时选否",
          showClose: true,
        });
        this.formData["10461246-142002428"].value = "";
      }
      if (val == "1") {
        this.formData["10461245-142002417"].isshow = true;
        this.SetRequired({
          attrName: "甲端汇聚类型",
          formkey: "10461245-142002417",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10461245-142002416"].isshow = true;
        this.SetRequired({
          attrName: "甲端汇聚VLAN序号/时隙号",
          formkey: "10461245-142002416",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.formData["10461245-142002417"].isshow = false;
        this.formData["10461245-142002417"].value = "";
        this.SetRequired({
          attrName: "",
          formkey: "10461245-142002417",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461245-142002416"].isshow = false;
        this.formData["10461245-142002416"].value = "";
        this.SetRequired({
          attrName: "",
          formkey: "10461245-142002416",
          reqName: "empty",
          reqStatus: false,
        });
      }
      this.collectTypeA(this.formData["10461245-142002417"].value); //甲端汇聚类型
    },

    collectB(val) {
      //乙端是否汇聚
      if (
        val == "2" &&
        this.formData["10461245-142002428"].value == "2" &&
        this.formData["10460341-100001004"].value == "88800130002"
      ) {
        this.$message({
          message: "甲端乙端是否汇聚不可以同时选否",
          showClose: true,
        });
        this.formData["10461245-142002428"].value = "";
        // val=1
      }
      if (val == "1") {
        this.formData["10461246-142002417"].isshow = true;
        this.SetRequired({
          attrName: "乙端汇聚类型",
          formkey: "10461246-142002417",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10461246-142002416"].isshow = true;
        this.SetRequired({
          attrName: "乙端汇聚VLAN序号/时隙号",
          formkey: "10461246-142002416",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.SetRequired({
          //乙端汇聚类型
          attrName: "",
          formkey: "10461246-142002417",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461246-142002417"].isshow = false;
        this.formData["10461246-142002417"].value = "";
        this.SetRequired({
          attrName: "汇聚VLAN序号/时隙号",
          formkey: "10461246-142002416",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461246-142002416"].isshow = false;
        this.formData["10461246-142002416"].value = "";
      }
      this.collectTypeB(this.formData["10461246-142002417"].value); //乙端汇聚类型
    },

    collectTypeA(val) {
      //甲端汇聚类型
      if (val == "80060008002") {
        this.SetRequired({
          attrName: "汇聚参考接入电路代号",
          formkey: "10461245-142002418",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.SetRequired({
          attrName: "",
          formkey: "10461245-142002418",
          reqName: "empty",
          reqStatus: false,
        });
      }
    },

    collectTypeB(val) {
      //乙端汇聚类型
      if (val == "80060008002") {
        this.SetRequired({
          attrName: "汇聚参考接入电路代号",
          formkey: "10461246-142002418",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.SetRequired({
          attrName: "",
          formkey: "10461246-142002418",
          reqName: "empty",
          reqStatus: false,
        });
      }
    },

    timeSlotANumber(val) {
      //汇聚VLAN序号/时隙号
      if (val > 4096) {
        this.$message({
          message: "只能填写1~4096之间的正整数",
          showClose: true,
        });
        this.formData["10461245-142002416"].value = "";
      }
    },

    timeSlotBNumber(val) {
      //汇聚VLAN序号/时隙号
      if (val > 4096) {
        this.$message({
          message: "只能填写1~4096之间的正整数",
          showClose: true,
        });
        this.formData["10461246-142002416"].value = "";
      }
    },

    //是否IDC机房专线  houbin add
    IDC(val) {
      if (val == "1") {
        this.formData["10460341-142002498"].isshow = true; //机房专线类型
        //this.SetRequired("1", "10460341-142002498"); //机房专线类型 必填
        this.SetRequired({
          attrName: "机房专线类型",
          formkey: "10460341-142002498",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.formData["10460341-142002498"].isshow = false; //机房专线类型 隐藏
        //this.SetRequired("0", "10460341-142002498"); //机房专线类型 非必填
        this.SetRequired({
          attrName: "",
          formkey: "10460341-142002498",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460341-142002498"].value = ""; //机房专线类型 清空
      }
      this.comLine(this.formData["10460341-142002498"].value);
    },

    //机房专线类型  houbin add
    comLine(val) {
      this.formData["10460341-142002499"].isshow = false; //甲端机房编码、
      // this.SetRequired("0", "10460341-142002499"); //甲端机房编码 非必填
      this.SetRequired({
        attrName: "",
        formkey: "10460341-142002499",
        reqName: "empty",
        reqStatus: false,
      });
      this.formData["10460341-100011034"].isshow = false; //乙端机房编码
      this.SetRequired({
        attrName: "乙端机房编码",
        formkey: "10460341-100011034",
        reqName: "empty",
        reqStatus: false,
      });
      if (val == "2468001") {
        this.formData["10460341-142002499"].isshow = true; //甲端机房编码
        this.SetRequired({
          attrName: "甲端机房编码",
          formkey: "10460341-142002499",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10460341-100011034"].value = ""; //乙端机房编码  清空
        this.formData["10460341-100011034"].text = "";
      } else if (val == "2468002") {
        this.formData["10460341-100011034"].isshow = true; //乙端机房编码
        this.SetRequired({
          attrName: "乙端机房编码",
          formkey: "10460341-100011034",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10460341-142002499"].value = ""; //甲端机房编码  清空
        this.formData["10460341-142002499"].text = "";
      } else if (val == "2468003") {
        this.formData["10460341-142002499"].isshow = true; //甲端机房编码
        this.formData["10460341-100011034"].isshow = true; //乙端机房编码
        this.SetRequired({
          attrName: "甲端机房编码",
          formkey: "10460341-142002499",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "乙端机房编码",
          formkey: "10460341-100011034",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.formData["10460341-142002499"].value = ""; //甲端机房编码  清空
        this.formData["10460341-142002499"].text = "";
        this.formData["10460341-100011034"].value = ""; //乙端机房编码  清空
        this.formData["10460341-100011034"].text = "";
      }
    },

    //MTU数值
    mtuNumber(val) {
      let check = /^[1-9]\d*$/;
      if (check.test(val)) {
        if (val > 9600 || val < 1518) {
          this.$alert("只能填写1518~9600之间的正整数!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
          this.formData["10460341-141000144"].value = "";
        }
      } else {
        this.$alert("只能填写1518~9600之间的正整数!", "提示", {
          type: "warning",
          confirmButtonText: "关闭",
        });
        this.formData["10460341-141000144"].value = "";
      }
    },

    //IPRAN暂时屏蔽“点到多点”，后端不支撑
    businessType(val) {
      //disabled暂不支持
      let value = this.formData["10460341-100001004"];
      if (val == "88800130002") {
        //点到多点
        this.formData["10461245-142002428"].isshow = true; //甲端是否汇聚 展示
        this.SetRequired({
          attrName: "甲端是否汇聚",
          formkey: "10461245-142002428",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10461246-142002428"].isshow = true; //乙端是否汇聚 展示
        this.SetRequired({
          attrName: "乙端是否汇聚",
          formkey: "10461246-142002428",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10461245-142002908"].isshow = true; //汇聚组号
        this.formData["10461246-142002908"].isshow = true;
        this.formData["10461245-142002910"].isshow = true; //汇聚同组电路数
        this.formData["10461246-142002910"].isshow = true;
      } else {
        //点到点
        this.formData["10461245-142002428"].isshow = false; //甲端是否汇聚主点 隐藏
        this.formData["10461245-142002428"].value = ""; //甲端是否汇聚主点 清空
        this.SetRequired({
          attrName: "甲端是否汇聚主点",
          formkey: "10461245-142002428",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461246-142002428"].isshow = false; //乙端是否汇聚主点 隐藏
        this.formData["10461246-142002428"].value = ""; //乙端是否汇聚主点 清空
        this.SetRequired({
          attrName: "乙端是否汇聚主点",
          formkey: "10461246-142002428",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461245-142002908"].isshow = false; //甲端汇聚组号
        this.formData["10461245-142002908"].value = "";
        this.formData["10461246-142002908"].isshow = false; //乙端汇聚组号
        this.formData["10461246-142002908"].value = "";
        this.formData["10461245-142002910"].isshow = false; //甲端汇聚同组电路数
        this.formData["10461245-142002910"].value = "";
        this.formData["10461246-142002910"].isshow = false; //乙端汇聚同组电路数
        this.formData["10461246-142002910"].value = "";
      }
      this.collectA(this.formData["10461245-142002428"].value); //甲端是否汇聚
      this.collectB(this.formData["10461246-142002428"].value); //乙端是否汇聚
    },

    //收费周期  houbin add
    monthCycle() {
      this.formData["10460378-142001024"].value = "";
      if (this.formData["10460378-100010009"].value == "80050019028") {
        this.formData["10460378-142001024"].isshow = true; //预收月数
        this.SetRequired({
          attrName: "预收月数",
          formkey: "10460378-142001024",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.formData["10460378-142001024"].isshow = false; //预收月数
        this.SetRequired({
          attrName: "",
          formkey: "10460378-142001024",
          reqName: "empty",
          reqStatus: false,
        });
      }
    },

    //费用限制
    numberCheck(val) {
      if (val == "0") {
        this.feeVal = val;
      } else {
        let oldValue = val;
        let newValue = val;
        newValue = newValue.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
        newValue = newValue.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
        newValue = newValue.replace(/^\./g, ""); //必须保证第一个为数字而不是.
        newValue = newValue
          .replace(".", "$#$")
          .replace(/\./g, "")
          .replace("$#$", ".");
        newValue = newValue.replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3"); //只能输入两个小数
        if (newValue) {
          let arr = newValue.split(".");
          newValue =
            Number(arr[0]) + (arr[1] === undefined ? "" : "." + arr[1]);
        }
        if (newValue.indexOf(".") < 0 && newValue != "") {
          //以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
          newValue = parseFloat(newValue);
        }
        if (oldValue != newValue) {
          this.$alert("请输入正整数或者小数点后两位小数!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
        }
        this.feeVal = newValue;
      }
    },

    //多云接入端口月使用费
    moreYunRent(val) {
      this.numberCheck(val);
      this.formData["10460378-142003015"].value = this.feeVal;
      this.feeVal = "";
    },

    //甲端调测费
    CommRentA(val) {
      this.numberCheck(val);
      this.formData["10460380-100012523"].value = this.feeVal;
      this.feeVal = "";
    },

    //乙端调测费
    CommRentB(val) {
      this.numberCheck(val);
      this.formData["10460381-100012523"].value = this.feeVal;
      this.feeVal = "";
    },

    //甲端月租费
    monthlyRentA(val) {
      this.numberCheck(val);
      this.formData["10460383-100010742"].value = this.feeVal;
      this.feeVal = "";
    },

    //乙端月租费
    monthlyRentB(val) {
      this.numberCheck(val);
      this.formData["10460384-100010742"].value = this.feeVal;
      this.feeVal = "";
    },

    //甲端代维费
    agentRentA(val) {
      this.numberCheck(val);
      this.formData["10460383-100012371"].value = this.feeVal;
      this.feeVal = "";
    },

    //乙端代维费
    agentRentB(val) {
      this.numberCheck(val);
      this.formData["10460384-100012371"].value = this.feeVal;
      this.feeVal = "";
    },

    //国内长途月租费
    domDistanceRent(val) {
      this.numberCheck(val);
      this.formData["10460385-100012567"].value = this.feeVal;
      this.feeVal = "";
    },

    //收款单位默认发起地   liuyang add
    async qryAccList() {
      let params = {
        interFaceType: "ORDER",
        sqlId: 2021070901,
        paramStr: "orgId:" + this.user.orgId,
      };

      const result = await OrderService.executeSql(params);
      if (result.code == 200) {
        if (result.meta.resList.executeSqlResps.length > 0) {
          //甲乙端一次性收款单位
          let UNITA = {
            UNIT_NAME: result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME,
            UNIT_CODE: result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE,
          };
          let UNITB = {
            UNIT_NAME: result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME,
            UNIT_CODE: result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE,
          };
          sessionStorage.setItem("UNITA", JSON.stringify(UNITA));
          sessionStorage.setItem("UNITB", JSON.stringify(UNITB));
          this.formData["10460427-100013365"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460427-100013365"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          this.formData["10460428-100013365"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460428-100013365"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          //甲乙端本地费用
          this.formData["10460383-100010007"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460383-100010007"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          this.formData["10460384-100010007"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460384-100010007"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          //国内长途收款单位
          this.formData["10460385-100011992"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460385-100011992"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          this.formData["10460385-100011991"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460385-100011991"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          //多云接入端口收款单位
          this.formData["10460378-100010007"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460378-100010007"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
        }
      }
    },

    //一次性费是否一口价  houbin add
    onceIPRANFee() {
      if (this.formData["10460378-100012076"].value == "1") {
        //是
        this.Isshow("1", "10460380"); //甲端一次性费用
        this.Isshow("1", "10460381"); //乙端一次性费用
        //this.SetRequired("1", "10460380-100010651"); //甲端一次性费币种 必填
        // this.SetRequired("1", "10460380-100012523"); //甲端调测费 必填
        //this.SetRequired("1", "10460381-100010651"); //乙端一次性费币种 必填
        // this.SetRequired("1", "10460381-100012523"); //乙端调测费 必填
        this.SetRequired({
          attrName: "甲端一次性费币种",
          formkey: "10460380-100010651",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "甲端调测费",
          formkey: "10460380-100012523",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "乙端一次性费币种",
          formkey: "10460381-100010651",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "乙端调测费",
          formkey: "10460381-100012523",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        //否
        this.Isshow("0", "10460380"); //甲端一次性费用 隐藏
        this.Isshow("0", "10460381"); //乙端一次性费用 隐藏
        // this.SetRequired("0", "10460380-100010651"); //甲端一次性费币种 非必填
        this.SetRequired({
          attrName: "",
          formkey: "10460380-100010651",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460380-100010651"].value = "156"; //甲端一次性费币种
        // this.SetRequired("0", "10460380-100012523"); //甲端调测费 非必填
        this.SetRequired({
          attrName: "",
          formkey: "10460380-100012523",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460380-100012523"].value = ""; //甲端调测费 清空
        //this.SetRequired("0", "10460381-100010651"); //乙端一次性费币种 非必填
        this.SetRequired({
          attrName: "",
          formkey: "10460381-100010651",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460381-100010651"].value = "156"; //乙端一次性费币种
        //.SetRequired("0", "10460381-100012523"); //乙端调测费 非必填
        this.SetRequired({
          attrName: "",
          formkey: "10460381-100012523",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460381-100012523"].value = ""; //乙端调测费 清空
      }
    },

    async getPluginValue(obj) {
      // let citySelectA = sessionStorage.getItem("citySelectA");
      // let proviceA = citySelectA.provice;
      // let citySelectB = sessionStorage.getItem("citySelectB");
      // let proviceB = citySelectB.provice;
      //
      //
      //城市插件选择带回
      if (obj.key == "10460288-100013695") {
        //是否管理电路的城市
      }
      if (obj.key == "1688-100010640") {
        let citySelectA = JSON.parse(sessionStorage.getItem("citySelectA"));
        let proviceA = "";
        if (citySelectA) {
          proviceA = citySelectA.address.provice; //甲端省
          const result = await OrderService.qryAttrRuleSwitch({
            ifVal: proviceA ? proviceA : "-1",
            useType: "disabledAddress",
            queryType: "count",
            valve: "80020160",
          });
          if (!result.meta.COUNT0 && result.meta.COUNT0 == 0) {
            this.formData["1688-100013021"].disabled = false;
          } else {
            this.formData["1688-100013021"].disabled = true;
          }
        }
        if (proviceA == "26177" || proviceA == "24976") {
          this.$alert("甲端城市不能选择香港、澳门!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
          this.formData["1688-100010640"].options[0].provice = ""; //将省置空
        }
        //黑龙江 装机地址只能选址
        // if (proviceA == "26269") {
        //   this.formData["1688-100013021"].disabled = true;
        // } else {
        //   this.formData["1688-100013021"].disabled = false;
        // }
      }
      if (obj.key == "1689-100010640") {
        let citySelectB = JSON.parse(sessionStorage.getItem("citySelectB"));
        let proviceB = "";
        if (citySelectB) {
          proviceB = citySelectB.address.provice; //乙端省
          const result = await OrderService.qryAttrRuleSwitch({
            ifVal: proviceB ? proviceB : "-1",
            useType: "disabledAddress",
            queryType: "count",
            valve: "80020160",
          });
          if (!result.meta.COUNT0 && result.meta.COUNT0 == 0) {
            this.formData["1689-100013021"].disabled = false;
          } else {
            this.formData["1689-100013021"].disabled = true;
          }
        }
        if (proviceB == "26177" || proviceB == "24976") {
          this.$alert("乙端城市不能选择香港、澳门!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
          this.formData["1689-100010640"].options[0].provice = ""; //将省置空
        }
        //黑龙江 装机地址只能选址
        // if (proviceB == "26269") {
        //   this.formData["1689-100013021"].disabled = true;
        // } else {
        //   this.formData["1689-100013021"].disabled = false;
        // }
      }

      if (obj.key == "10460342-142002189") {
        //专属云id返回数据带给专属云名称
        const { name } = obj.value;
        this.formData["10460342-142002183"].value = name;
      }
      if (obj.key == "10460342-142002011") {
        //本端VPC ID返回数据带给本端VPC ID网段/掩码
        const { cidr } = obj.value;
        this.formData["10460342-142002152"].value = cidr;
      }
    },
    //月租费是否一口价  houbin add
    monthFEE(val) {
      if (val == "1") {
        this.Isshow("1", "10460383"); //甲乙端本地费用
        this.Isshow("1", "10460385"); //国内长途
      } else {
        this.Isshow("0", "10460383"); ///甲乙端本地费用
        this.Isshow("0", "10460385"); //国内长途
        this.formData["10460383-100010742"].value = ""; //甲端月租费
        this.formData["10460384-100010742"].value = ""; //乙端月租费
        this.formData["10460383-100012371"].value = ""; //甲端代维费
        this.formData["10460384-100012371"].value = ""; //乙端代维费
        this.formData["10460385-100012567"].value = ""; //国内长途月租费
      }
    },

    // SetRequired(value, id) {
    //   //必填验证设置
    //   if (document.getElementById(id)) {
    //     let classVal = document.getElementById(id).getAttribute("class");
    //     if (value == "1") {
    //       //增加必填验证
    //       classVal = classVal.concat(" is-required");
    //       document.getElementById(id).setAttribute("class", classVal);
    //     }
    //     if (value == "0") {
    //       //去掉必填验证
    //       classVal = classVal.replace("is-required", "");
    //       document.getElementById(id).setAttribute("class", classVal);
    //     }
    //   }
    // },

    //国家，默认“中国”，不可改；省，不可选择港澳台。只允许选择境内城市
    Country() {
      //插件ATOB内引用的组件
      let ruleData = this.ruleData;

      let formData = this.formData;
    },

    //非正常电路初始化
    nonGeneralCircuit() {
      this.formData["10460378-142002191"].isshow = true; //电路标签文号
      this.SetRequired({
        attrName: "电路标签文号",
        formkey: "10460378-142002191",
        reqName: "empty",
        reqStatus: true,
      });
      //工程，公免，公纳设置默认值
      //this.formData["10460378-142002191"].disabled = true;
      //一次性费是否一口价
      this.formData["10460378-100012076"].value = "1";
      this.formData["10460378-100012076"].disabled = true;
      //月租费是否一口价
      this.formData["10460378-100012610"].value = "1";
      this.formData["10460378-100012610"].disabled = true;
      //是否与首次月租一起支付
      this.formData["10460378-100011646"].value = "80050003001";
      this.formData["10460378-100011646"].disabled = true;
      //一次性收费方式
      this.formData["10460378-100011007"].value = "30080002";
      this.formData["10460378-100011007"].disabled = true;
      //一次性费是否公免或免费
      this.formData["10460378-141000009"].value = "10";
      this.formData["10460378-141000009"].disabled = true;
      //收费周期
      this.formData["10460378-100010009"].value = "80050019001";
      this.formData["10460378-100010009"].disabled = true;
      //月租收费方式
      this.formData["10460378-100011534"].value = "30080002";
      this.formData["10460378-100011534"].disabled = true;
      //月租是否公免或免费
      this.formData["10460378-141000010"].value = "10";
      this.formData["10460378-141000010"].disabled = true;
      //甲端调测费
      this.formData["10460380-100012523"].value = "0";
      this.formData["10460380-100012523"].disabled = true;
      //乙端调测费
      this.formData["10460381-100012523"].value = "0";
      this.formData["10460381-100012523"].disabled = true;
      //甲端月租费
      this.formData["10460383-100010742"].value = "0";
      this.formData["10460383-100010742"].disabled = true;
      //甲端优惠率
      this.formData["10460383-100011694"].value = "0";
      this.formData["10460383-100011694"].disabled = true;

      //乙端月租费
      this.formData["10460384-100010742"].value = "0";
      this.formData["10460384-100010742"].disabled = true;
      //乙端优惠率
      this.formData["10460384-100011694"].value = "0";
      this.formData["10460384-100011694"].disabled = true;

      //国内长途月租费
      this.formData["10460385-100012567"].value = "0";
      this.formData["10460385-100012567"].disabled = true;

      //甲端长途委托收费单位
      this.formData["10460385-100012144"].disabled = true;

      //乙端长途委托收费单位
      this.formData["10460385-100012143"].disabled = true;

      //甲端一次性费用委托收款单位
      this.formData["10460427-100013366"].disabled = true;
      //乙端一次性费用委托收款单位
      this.formData["10460428-100013366"].disabled = true;

      //收款单位禁用
      //甲乙端一次性收款单位
      this.formData["10460427-100013365"].disabled = true;
      this.formData["10460428-100013365"].disabled = true;

      //国内长途收款单位
      this.formData["10460385-100011992"].disabled = true;
      this.formData["10460385-100011991"].disabled = true;
    },

    //根据component的参数动态返回dialog-input需要的绑定参数
    dialogInputConfig(val) {
      const configName = val.split("|")[1];
      if (!configName) {
        return {};
      }
      return require(`./${configName}.js`).default;
    },

    ctrlfold(fold, id) {
      //展开收起

      if (id == "10460339") {
        //业务信息展开收起
        if (fold) {
          this.Isshow("1", "10461245"); //甲乙端业务信息外框展示
        } else {
          this.Isshow("0", "10461245"); //甲乙端业务信息外框展示
        }
      }
      if (id == "10460378") {
        //资费信息展开收起
      }
    },
    //获取input-grid选中的值
    getInputGridValue(obj) {
      let key = obj["key"];
      if (key == "10460427-100013365") {
        //甲端一次性收款单位
        // user.orgId != '1944640'
        let user = JSON.parse(sessionStorage.getItem("crm3-userinfo"));
        if (user.orgId != "1944640" && obj.data.orgId == "1944640") {
          this.formData["10460427-100013365"].text = JSON.parse(
            sessionStorage.getItem("UNITA")
          )
            ? JSON.parse(sessionStorage.getItem("UNITA")).UNIT_NAME
            : "";
          this.formData["10460427-100013365"].value = JSON.parse(
            sessionStorage.getItem("UNITA")
          )
            ? JSON.parse(sessionStorage.getItem("UNITA")).UNIT_CODE
            : "";
          this.$confirm("省客户不能选择集团公司为收款单位!", "提示", {
            confirmButtonText: "关闭",
            showCancelButton: false,
            type: "warning",
            center: true,
          });
        } else {
          let UNITA = {
            UNIT_NAME: this.formData["10460427-100013365"].text,
            UNIT_CODE: this.formData["10460427-100013365"].value,
          };
          sessionStorage.setItem("UNITA", JSON.stringify(UNITA));
        }
      }
      if (key == "10460428-100013365") {
        //乙端一次性收款单位
        let user = JSON.parse(sessionStorage.getItem("crm3-userinfo"));
        if (user.orgId != "1944640" && obj.data.orgId == "1944640") {
          this.formData["10460428-100013365"].text = JSON.parse(
            sessionStorage.getItem("UNITB")
          )
            ? JSON.parse(sessionStorage.getItem("UNITB")).UNIT_NAME
            : "";
          this.formData["10460428-100013365"].value = JSON.parse(
            sessionStorage.getItem("UNITB")
          )
            ? JSON.parse(sessionStorage.getItem("UNITB")).UNIT_CODE
            : "";
          this.$confirm("省客户不能选择集团公司为收款单位!", "提示", {
            confirmButtonText: "关闭",
            showCancelButton: false,
            type: "warning",
            center: true,
          });
        } else {
          let UNITB = {
            UNIT_NAME: this.formData["10460428-100013365"].text,
            UNIT_CODE: this.formData["10460428-100013365"].value,
          };
          sessionStorage.setItem("UNITB", JSON.stringify(UNITB));
        }
      }
    },
    async devIsEmptyIPRAN() {
      const result = await OrderService.qryAttrRuleSwitch({
        shengFlag: "sheng",
        regionType: this.user.regionType ? this.user.regionType : "-1",
        regionId: this.user.regionId ? this.user.regionId : "-1",
        ifVal: this.user.regionCode ? this.user.regionCode : "-1",
        useType: "developPerson",
        queryType: "count",
      });
      if (result.meta.COUNT0 && result.meta.COUNT0 != 0) {
        this.formData["100013695"].required = true;
      }
    },
    onceFeeFree (){
      if(this.formData["10460378-141000009"].value=="10"||this.formData["10460378-141000009"].value=="11"){
        this.formData["10460378-100012076"].value='1';//一次性费默认为是不可改
        this.formData["10460378-100012076"].disabled=true;
        this.onceIPRANFee(this.formData["10460378-100012076"].value); 
        this.formData["10460380-100012523"].value='0';
        this.formData["10460381-100012523"].value='0';
        this.formData["10460380-100012523"].disabled=true;
        this.formData["10460381-100012523"].disabled=true;
      }else{
        this.formData["10460378-100012076"].disabled=false;
        this.formData["10460380-100012523"].disabled=false;
        this.formData["10460381-100012523"].disabled=false;
       }
    }
  },
};
</script>